#include <bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define endl "\n"
using namespace std;
typedef long long ll;
int n, tmp, now, pre = -1;
vector<int> in, nums;
int cnt[100010];
int ans, sum;
int main()
{
    IOS;
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);
    cin >> n;
    for(int i = 0; i < n; i ++) cin >> tmp, in.push_back(tmp);
    sort(in.begin(), in.end());
    for(int i = 0; i < n; i ++)
    {
        if(in[i] != pre) nums.push_back(++ now), pre = in[i];
        else nums.push_back(now);
    }
    for(auto it : nums) cnt[it] ++;
    sum = cnt[1];
    for(int i = 2; i <= now; i ++)
    {
        ans += min(sum, cnt[i]);
        sum -= min(sum, cnt[i]);
        sum += cnt[i];
    }
    cout << n - ans;
    return 0;
}
